package ServletDemo;
/**
 * 欢迎页面
 */

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class welcome extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter out = resp.getWriter();
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=UTF-8"); //设置响应的 MIME类型。
        out.println("<HTML>");
        out.println("<BODY>");
        out.write("欢迎");
        //resp.sendRedirect("http://localhost:8080/javaWeb_war_exploded/ServletDemo/cookiesDemo");
        out.println("</BODY>");
        out.println("</HTML>");
    }
}
